home *** CD-ROM | disk | FTP | other *** search
/ Meeting Pearls 2 / Meeting Pearls Vol. II (1995)(GTI - Schatztruhe)[!].iso / Pearls / text / SoundBox / bonus / dt_scan.rexx < prev    next >
OS/2 REXX Batch file  |  1994-12-21  |  3KB  |  117 lines

  1. /*  DT-ARexx-Script
  2.     Scannen mehrerer Module und Erstellen einer Liste
  3.     $VER: dt_scan.rexx 0.4 (17.11.94) ©1994 ninji :-)
  4. */
  5.  
  6. options results
  7.  
  8. pt_player       = "ProTracker NoiseTracker SoundTracker15 StarTrekker4"
  9.  
  10. call addlib("rexxreqtools.library", 0, -30, 0)
  11. logfile = rtfilerequest(,
  12.     'RAM:','modul.list',,
  13.     'Bitte Zieldatei wählen ..',,"rtfi_matchpat='~(#?.info|.#?)'",okay)
  14. if (okay ~= 1) then exit
  15.  
  16. if exists(logfile) then
  17.     open(log, logfile, append)
  18. else open(log, logfile, write)
  19.  
  20. writeln(log, 'Scan-Ergebnis (' || date() || ',' time() || ')' || '0a'x)
  21. close(log)
  22.  
  23. address DELITRACKER
  24.  
  25. saveconfig 'T:DT.config'
  26.  
  27. randmod no ;randsong no ;mod_num = 0
  28.  
  29. options failat 20
  30. playlist 1
  31. error = rc
  32. options results
  33.  
  34. do until (mod_num == 1)
  35.  
  36.     if (error ~= 0) then call write_fail
  37.     else call write_okay
  38.  
  39.     nextsong
  40.     error = rc
  41.  
  42.     status m num ;mod_num = result
  43.     end
  44.  
  45. loadconfig 'T:DT.config'
  46. address command 'delete T:DT.config'
  47. exit
  48.  
  49. write_fail:
  50.     call open(log, logfile, append)
  51.     call writeln(log, '  »»»» Oooops ... was''n das ?' || '0a'x)
  52.     call close(log)
  53.     error = 0
  54.     return
  55.  
  56. write_okay:
  57.     'status m dir'  ;mod_dir = result
  58.     status m fil    ;mod_fil = result
  59.     status m fmt    ;mod_fmt = result
  60.     status m nam    ;mod_nam = result
  61.     status m pnr    ;pnr_num = result
  62.  
  63.     'status p' pnr_num 'nam'    ;pnr_nam = result
  64.     'status p' pnr_num 'ver'    ;pnr_ver = result
  65.     'status p' pnr_num 'sub'    ;pnr_sub = result
  66.  
  67.     extens = ''
  68.     if (pos(mod_fmt,pt_player) ~= 0) then call get_samples
  69.  
  70.     if (pnr_sub == 'yes') then
  71.         extens = '  (Subsongs möglich)' || extens || '0a'x
  72.     else extens = extens || '0a'x
  73.  
  74.     address command 'list nohead "' || mod_dir || mod_fil || '" >T:dt_temp'
  75.     call open tempfile, 'T:dt_temp', read
  76.     fileinfo = readln(tempfile)
  77.     call close tempfile
  78.  
  79.     call open log, logfile, append
  80.     call writeln log, fileinfo || '0a'x,
  81.         '  Modul-Name: ' || '09'x || '"'mod_nam'"' || '0a'x,
  82.         '  Format:     ' || '09'x || mod_fmt || '0a'x ||,
  83.         extens
  84.     call close log
  85.     return
  86.  
  87. get_samples:
  88.     if (open(modul,mod_dir || mod_fil,read)) then do
  89.         string = readch(modul,20)
  90.         if (substr(string,1,4) == 'XPKF') then
  91.             extens = extens || '    XPK-gepacktes Modul (' || substr(string,9,4) || ')'
  92.         else do
  93.             i = 1
  94.             if (mod_fmt ~= 'SoundTracker15') then k = 32
  95.             else k = 16
  96.             do while(i < k)
  97.                 string = readch(modul,30)
  98.                 if (mod_fmt == 'NoiseTracker') then
  99.                     name = translate(substr(string,1,22), ' ' || xrange('01'x,'ff'x), '00'x || xrange('01'x,'ff'x))
  100.                 else name = translate(substr(string,1,21), ' ' || xrange('01'x,'ff'x), '00'x || xrange('01'x,'ff'x))
  101.                 name = left(name,22)
  102.  
  103.                 if (mod_fmt == 'NoiseTracker') then
  104.                     length = x2d(c2x(substr(string,23,2)))
  105.                 else length = x2d(c2x(substr(string,23,2)))
  106.                 length = length*2
  107.  
  108.                 if (strip(name) ~= '' | length ~= 0) then
  109.                     extens = extens || '    #' || right(d2x(i),2) || ':',
  110.                         name right(length,9) || '0A'x
  111.                 i = i+1
  112.                 end
  113.             end
  114.         call close(modul)
  115.         end
  116.     return
  117.